<template>
  <div class="wrapper">
    <!-- <img src="@/assets/404.jpg" alt="404 Not Found"> -->
    <!-- 访问的页面不存在! <br> -->
    <!-- 将在 {{ count }} 秒后返回<router-link to="/" style="color: red;">主页</router-link>。 -->
    <el-button class="btn" round type="danger" @click="backToHome">返回首页</el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      count: 5,
      timer: undefined
    }
  },
  methods: {
    checkCount() {
      if (this.count > 0) {
        this.count--
      } else {
        clearInterval(this.timer)
        this.$router.replace('/')
      }
    },
    backToHome() {
      this.$router.replace('/')
    }
  }
  // mounted() {
  //   this.timer = setInterval(() => {
  //     this.checkCount()
  //   }, 1000)
  // }
}
</script>

<style lang="scss" scoped>
.wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  background-image: url('@/assets/404.jpg');
  background-position: center;
  background-size: cover;

  .btn {
    position: absolute;
    left: 100px;
    top: 170px;
  }
}
</style>
